#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Farmer Li, 公众号: 很酷的程序员/RealCoolEngineer
# @Date: 2023-02-27
# @Question: https://www.zhihu.com/question/601329359/answer/3046179757

import click


def int2str(v):
    return f'{v:2d}'  # 最大行数字位数可调


def gen_one_line(nrow):
    res = list(range(1, nrow + 1)) + list(range(nrow - 1, 0, -1))
    return ' '.join(map(int2str, res))


def funny_print(nrows):
    final_line = gen_one_line(nrows)
    max_width = len(final_line)
    for i in range(1, nrows):
        line = gen_one_line(i)
        print("{:>{}}".format(line, max_width))

    print(final_line)


@click.command()
@click.argument('nrows', type=int)
def main(nrows):
    funny_print(nrows)


if __name__ == '__main__':
    main()
